home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
rjs.lha
/
RJS
/
String
/
tests
/
ttrim.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-14
|
1KB
|
44 lines
#include "test.h"
void Trim()
{
String s0(" abcd ");
String s1("ab c ");
String s2(" ab");
String s3("a");
String s4("");
String s5(" ");
Assert(trim(s0)=="abcd");
Assert(trim(s1)=="ab c");
Assert(trim(s2)=="ab");
Assert(trim(s3)=="a");
Assert(trim(s4)=="");
Assert(trim(s5)=="");
Assert(trim(s0,String::Left)=="abcd ");
Assert(trim(s0,String::Right)==" abcd");
Assert(s0.trim()=="abcd"); s0.VERIFY();
Assert(s1.trim()=="ab c"); s1.VERIFY();
Assert(s2.trim()=="ab"); s2.VERIFY();
Assert(s3.trim()=="a"); s3.VERIFY();
Assert(s4.trim()==""); s4.VERIFY();
Assert(s5.trim()==""); s5.VERIFY();
s0=" abcd "; Assert(trim(s0,String::Left)=="abcd ");
s0=" abcd "; Assert(trim(s0,String::Right)==" abcd");
Assert(trim(" abcd ")=="abcd");
Assert(trim("ab c ")=="ab c");
Assert(trim(" ab")=="ab");
Assert(trim("a")=="a");
Assert(trim("")=="");
Assert(trim(" ")=="");
Assert(trim(" a",String::Left)=="a");
Assert(trim("a ",String::Right)=="a");
s0="this is a test";
Assert(s0.after(" is").before("test").trim()=="a");
Assert(s0=="this isatest");
}